import request from '@/utils/request'
import type { PicturePage } from '@/api/types/picture'

export const add = (data: {
  imageName: string,
  imageUrl: string
}) => {
  return request<boolean>({
    method: 'post',
    url: '/admin/sysPicture',
    data
  })
}

export const pageList = (params: {
  current: number,
  size: number,
  imageName?: string
}) => {
  return request<PicturePage>({
    method: 'get',
    url: '/admin/sysPicture/page',
    params
  })
}

export const update = (pictureId: number, imageName: string) => {
  return request<boolean>({
    method: 'put',
    url: '/admin/sysPicture/' + pictureId + '/' + imageName
  })
}

export const deleteByIds = (ids: number | number[]) => {
  return request<boolean>({
    method: 'delete',
    url: '/admin/sysPicture/' + String(ids)
  })
}